package com.pignest.hotel.beans;

import java.util.Date;

import com.pignest.hotel.annotation.Bean;
import com.pignest.hotel.beans.global.BaseBean;
import com.pignest.hotel.definition.ChargeOpType;
import com.pignest.hotel.definition.PayMethod;

@Bean("值班记录")
public class DutyLog extends BaseBean {
	private static final long serialVersionUID = 1337221467233055260L;

	private Duty duty;
	private String userName;
	private Date time;
	private String action;		//充值, 消费, 交接, 财务提款, 初始金额
	private String method;		//付款方式, 现金, 借记卡, 信用卡, 会员卡, (积分)
	private int money;
	private String description;
	
	public DutyLog() {
	}
	
	/** 接接班 */
	public DutyLog(Duty duty1, Duty duty2, boolean a) {
		this.duty = duty1;
		this.userName = duty.getUser().getName();
		this.time = new Date();
		this.action = a ? "接班" : "交班";
		this.method = "现金";
		this.money = a ? duty2.getEndCash() : -duty1.getEndCash();
	}
	
	/** 备用金, 财务提款 */
	public DutyLog(Duty duty, int money) {
		this.duty = duty;
		this.userName = duty.getUser().getName();
		this.time = new Date();
		this.action = money > 0 ? "备用金" : "财务提款";
		this.method = "现金";
		this.money = money;
	}
	
	/** 接待 收款 */
	public DutyLog(Duty duty, int money, ChargeOpType purpose, PayMethod method, String description) {
		this.duty = duty;
		this.userName = duty.getUser().getName();
		this.time = new Date();
		this.action = purpose.getName();
		this.method = method.getDisplayName();
		this.money = money;
		this.description = description;
	}
	
	public Duty getDuty() {
		return duty;
	}
	public void setDuty(Duty duty) {
		this.duty = duty;
	}
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public Date getTime() {
		return time;
	}
	public void setTime(Date time) {
		this.time = time;
	}
	public int getMoney() {
		return money;
	}
	public void setMoney(int money) {
		this.money = money;
	}
	public String getAction() {
		return action;
	}
	public void setAction(String type) {
		this.action = type;
	}
	public String getMethod() {
		return method;
	}
	public void setMethod(String method) {
		this.method = method;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	
	
}
